<!DOCTYPE html>


<html lang="en">
  

    <head>
      <meta charset="utf-8" />
        
      <meta
        name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1"
      />
      <title>GBase8s集群管理程序WeiCM介绍和部署步骤 |  朝花夕拾</title>
  <meta name="generator" content="hexo-theme-ayer">
      
      <link rel="shortcut icon" href="/ww.ico" />
       
<link rel="stylesheet" href="/dist/main.css">

      
<link rel="stylesheet" href="/css/fonts/remixicon.css">

      
<link rel="stylesheet" href="/css/custom.css">
 
      <script src="https://cdn.staticfile.org/pace/1.2.4/pace.min.js"></script>
       
 

      <link
        rel="stylesheet"
        href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-bulma@5.0.1/bulma.min.css"
      />
      <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.19/dist/sweetalert2.min.js"></script>

      <!-- mermaid -->
      
      <style>
        .swal2-styled.swal2-confirm {
          font-size: 1.6rem;
        }
      </style>
    </head>
  </html>
</html>


<body>
  <div id="app">
    
      
    <main class="content on">
      <section class="outer">
  <article
  id="post-GBase8s集群管理程序WeiCM介绍和部署步骤"
  class="article article-type-post"
  itemscope
  itemprop="blogPost"
  data-scroll-reveal
>
  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  GBase8s集群管理程序WeiCM介绍和部署步骤
</h1>
 

      
    </header>
     
    <div class="article-meta">
      <a href="/2023/05/10/GBase8s%E9%9B%86%E7%BE%A4%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8FWeiCM%E4%BB%8B%E7%BB%8D%E5%92%8C%E9%83%A8%E7%BD%B2%E6%AD%A5%E9%AA%A4/" class="article-date">
  <time datetime="2023-05-10T01:36:01.000Z" itemprop="datePublished">2023-05-10</time>
</a> 
  <div class="article-category">
    <a class="article-category-link" href="/categories/Develop/">Develop</a>
  </div>
  
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> Word count:</span>
            <span class="post-count">2.1k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> Reading time≈</span>
            <span class="post-count">9 min</span>
        </span>
    </span>
</div>
 
    </div>
      
    <div class="tocbot"></div>




  
    <div class="article-entry" itemprop="articleBody">
       
  <h1 id="GBase8s集群管理程序介绍和部署"><a href="#GBase8s集群管理程序介绍和部署" class="headerlink" title="GBase8s集群管理程序介绍和部署"></a>GBase8s集群管理程序介绍和部署</h1><p>​		说明，WeiCM，WeiDbManager ，WeiOsManager 这些程序暂时这么命名，待公司收并后，可统一改名为：GBaseCM，GBaseDbManager ，GBaseOsManager。</p>
<h2 id="新旧CM对比介绍"><a href="#新旧CM对比介绍" class="headerlink" title="新旧CM对比介绍"></a>新旧CM对比介绍</h2><blockquote>
<h3 id="自带Connection-Manager："><a href="#自带Connection-Manager：" class="headerlink" title="自带Connection Manager："></a>自带Connection Manager：</h3></blockquote>
<ul>
<li>数据库自带的集群管理程序 Connection Manager 弊端： <ul>
<li>没有vip，需要代理或者转发。</li>
<li>源码复杂，并且谨慎有余灵活不足，不能满足客户特殊需求。</li>
</ul>
</li>
</ul>
<blockquote>
<h3 id="新开发的WeiCM："><a href="#新开发的WeiCM：" class="headerlink" title="新开发的WeiCM："></a>新开发的WeiCM：</h3></blockquote>
<ul>
<li><p>组件如下：</p>
<ul>
<li><p><strong>WeiDbManager</strong> ：对DB实施操作的代理接口，提供数据库启停，角色切换，集群关系定义接口。</p>
</li>
<li><p><strong>WeiOsManager</strong> ：对OS实施操作的代理接口，提供vip绑定解绑接口。</p>
</li>
<li><p><strong>WeiCM</strong> ： 负责集群定义，负责节点自恢复，负责节点角色切换，负责主角色选举，负责VIP切换。</p>
<p>( WeiCM有windows版本和Linux版，分别是：<strong>WeiCM.exe 和 WeiCM</strong> )</p>
</li>
</ul>
</li>
</ul>
<h2 id="部署架构图"><a href="#部署架构图" class="headerlink" title="部署架构图"></a>部署架构图</h2><ul>
<li>部署架构图 <img src="D:\Lenovo\Documents\0397f16193064d7db8ef85f0320c46c8.png" alt="在这里插入图片描述"></li>
</ul>
<p>下文示例中：</p>
<p>​	集群CM节点：     1.1.1.1                               (<strong>运行程序 WeiCM.exe 或 WeiCM</strong>)；</p>
<p>​	Database节点一：1.1.1.2                               (<strong>运行程序 WeiOsManager和WeiDbManager</strong>**)；</p>
<p>​	Database节点二：1.1.1.3                               (<strong>运行程序 WeiOsManager和WeiDbManager</strong>**)；</p>
<h2 id="部署前提条件"><a href="#部署前提条件" class="headerlink" title="部署前提条件"></a>部署前提条件</h2><ul>
<li>Database节点一和Database节点二之间gbasedbt用户的ssh信任关系配置完成。</li>
<li>Database节点一和Database节点二之间RSS集群管理配置完成。</li>
</ul>
<h2 id="WeiCM部署步骤"><a href="#WeiCM部署步骤" class="headerlink" title="WeiCM部署步骤"></a>WeiCM部署步骤</h2><p>​		说明：下文没有说明在哪个节点操作，就是在两个Database节点都要操作。</p>
<h3 id="步骤00：清理残留进程"><a href="#步骤00：清理残留进程" class="headerlink" title="步骤00：清理残留进程"></a>步骤00：清理残留进程</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">ps -ef |grep WeiOsManager |grep -v grep |awk &#x27;&#123;print &quot;kill -9 &quot;$2&#125;&#x27;|sh</span><br><span class="line">ps -ef |grep WeiDbManager |grep -v grep |awk &#x27;&#123;print &quot;kill -9 &quot;$2&#125;&#x27;|sh</span><br></pre></td></tr></table></figure>



<h3 id="步骤01：上传程序包到两个DB节点"><a href="#步骤01：上传程序包到两个DB节点" class="headerlink" title="步骤01：上传程序包到两个DB节点"></a>步骤01：上传程序包到两个DB节点</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">root用户操作</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">准备目录</span></span><br><span class="line">rm -fr   /tmp/WEICMLOG/</span><br><span class="line">rm -fr   /home/gbase/sysInfo</span><br><span class="line">rm -fr    /opt/gbase/sysInfo</span><br><span class="line">mkdir -p /home/gbase/sysInfo/WeiShell</span><br><span class="line">mkdir -p  /opt/gbase/sysInfo/WeiShell</span><br><span class="line">chown -R gbasedbt:gbasedbt /home/gbase/sysInfo</span><br><span class="line">chown -R gbasedbt:gbasedbt  /opt/gbase/sysInfo</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">上传目录</span></span><br><span class="line">mkdir -p /opt/weicm/soft</span><br><span class="line">cd /opt/weicm/soft</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">上传newWeiCM.zip到这个目录下，然后解压</span></span><br><span class="line">unzip newWeiCM.zip</span><br><span class="line">mv 更新-加入token身份验证-添加Linux版本 newcm</span><br><span class="line">cd /opt/weicm/soft/newcm</span><br><span class="line">chmod 755 Wei*</span><br><span class="line">chmod 755 *sh</span><br></pre></td></tr></table></figure>



<h3 id="步骤02：WeiOsManager-部署"><a href="#步骤02：WeiOsManager-部署" class="headerlink" title="步骤02：WeiOsManager 部署"></a>步骤02：WeiOsManager 部署</h3><p>使用root用户复制粘贴全部下文：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">cd /opt/weicm/soft/newcm</span><br><span class="line">cp WeiOsManager /opt/gbase/sysInfo/WeiShell/</span><br><span class="line">cp -r templates /opt/gbase/sysInfo/</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">启动样例,这里不要操作，后面会配置进开机自启：</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash"><span class="built_in">nohup</span> ./WeiOsManager -i 1.1.1.6 -d eth1 -l 1.1.1.2 &amp;</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash"><span class="built_in">nohup</span> ./WeiOsManager -i 1.1.1.6 -d eth1 -l 1.1.1.3 &amp;</span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">手动绑定IP样例，这里不要操作</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">ip addr add 1.1.1.6/24 dev eth1</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">ip addr del 1.1.1.6/24 dev eth1</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>



<h3 id="步骤03：数据库添加别名"><a href="#步骤03：数据库添加别名" class="headerlink" title="步骤03：数据库添加别名"></a>步骤03：数据库添加别名</h3><p>使用gbasedbt用户复制粘贴全部下文：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">ONCONFIG 添加别名</span></span><br><span class="line">sed -i &#x27;s/^DBSERVERALIASES.*/DBSERVERALIASES gbase/&#x27; /opt/gbase/etc/$ONCONFIG</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">SQLHOSTS 添加别名</span></span><br><span class="line">cat &gt;&gt; /opt/gbase/etc/sqlhosts &lt;&lt; EOF</span><br><span class="line"></span><br><span class="line">gbase    onsoctcp 0.0.0.0  9089</span><br><span class="line"></span><br><span class="line">EOF</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">重启数据库</span></span><br><span class="line">onmode -ky</span><br><span class="line">onclean -ky</span><br><span class="line">oninit -v</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">查看别名监听已经启动</span></span><br><span class="line">netstat -lntp |grep 9089</span><br><span class="line"></span><br></pre></td></tr></table></figure>



<h3 id="步骤04：WeiDbManager-部署"><a href="#步骤04：WeiDbManager-部署" class="headerlink" title="步骤04：WeiDbManager 部署"></a>步骤04：WeiDbManager 部署</h3><p>使用gbasedbt用户复制粘贴全部下文：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">su - gbasedbt</span></span><br><span class="line">cd /opt/weicm/soft/newcm</span><br><span class="line">cp WeiDbManager   /home/gbase/sysInfo/WeiShell/</span><br><span class="line">cp pingtest.sh    /home/gbase/sysInfo/WeiShell/</span><br><span class="line">cp GetNodeInfo.sh /home/gbase/sysInfo/WeiShell/</span><br><span class="line">cp -r templates   /home/gbase/sysInfo/</span><br></pre></td></tr></table></figure>





<h3 id="步骤05：WeiCM-部署"><a href="#步骤05：WeiCM-部署" class="headerlink" title="步骤05：WeiCM 部署"></a>步骤05：WeiCM 部署</h3><p>​		说明：步骤05的所有操作在1.1.1.1主机上用root用户执行：</p>
<blockquote>
<p>复制WeiCM程序到管理节点，并改名为WeiCMAAABBBCCC</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">rm -fr   /opt/gbase/sysInfo/CM/</span><br><span class="line">mkdir -p /opt/gbase/sysInfo/CM/</span><br><span class="line"></span><br><span class="line">cd /opt/gbase/sysInfo/CM/</span><br><span class="line">scp 1.1.1.2:/opt/weicm/soft/newcm/WeiCM ./WeiCMAAABBBCCC</span><br><span class="line">scp 1.1.1.2:/opt/weicm/soft/newcm/runWeiCMAAABBBCCC.sh ./runWeiCMAAABBBCCC.sh</span><br></pre></td></tr></table></figure>


<blockquote>
<p>创建配置文件NodeBase.json</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">cd /opt/gbase/sysInfo/CM/</span><br><span class="line">cat &gt; /opt/gbase/sysInfo/CM/NodeBase.json &lt;&lt; EOF</span><br><span class="line">[</span><br><span class="line">    &#123;</span><br><span class="line">        &quot;ServName&quot;: &quot;gbase001&quot;,</span><br><span class="line">        &quot;ServIP&quot;: &quot;1.1.1.2&quot;,</span><br><span class="line">        &quot;HostIP&quot;: &quot;1.1.1.2&quot;,</span><br><span class="line">        &quot;ServPort&quot;: &quot;9089&quot;,</span><br><span class="line">        &quot;HostPort&quot;: &quot;9089&quot;,</span><br><span class="line">        &quot;ServInfoPort&quot;: &quot;6060&quot;,</span><br><span class="line">        &quot;HostInfoPort&quot;: &quot;6060&quot;,</span><br><span class="line">        &quot;Listenip&quot;: &quot;1.1.1.2&quot;,</span><br><span class="line">        &quot;Listenport&quot;: &quot;6061&quot;</span><br><span class="line">    &#125;,</span><br><span class="line">    &#123;</span><br><span class="line">        &quot;ServName&quot;: &quot;gbase002&quot;,</span><br><span class="line">        &quot;ServIP&quot;: &quot;1.1.1.3&quot;,</span><br><span class="line">        &quot;HostIP&quot;: &quot;1.1.1.3&quot;,</span><br><span class="line">        &quot;ServPort&quot;: &quot;9089&quot;,</span><br><span class="line">        &quot;HostPort&quot;: &quot;9089&quot;,</span><br><span class="line">        &quot;ServInfoPort&quot;: &quot;6060&quot;,</span><br><span class="line">        &quot;HostInfoPort&quot;: &quot;6060&quot;,</span><br><span class="line">        &quot;Listenip&quot;: &quot;1.1.1.3&quot;,</span><br><span class="line">        &quot;Listenport&quot;: &quot;6061&quot;</span><br><span class="line">    &#125;</span><br><span class="line">]</span><br><span class="line">EOF</span><br></pre></td></tr></table></figure>



<ul>
<li>NodeBase.json文件说明（为容器方式部署预留了端口映射）根据你都需要修改json字段值： <ul>
<li>实例名 （同时用作容器名）</li>
<li>数据库监听IP</li>
<li>宿主机IP</li>
<li>数据库监听端口</li>
<li>宿主机映射数据库监听端口</li>
<li>信息采集及WeiDbManager端口</li>
<li>宿主机映射信息采集及WeiDbManager端口</li>
<li>VIP管理WeiOsManager监听IP</li>
<li>VIP管理WeiOsManager监听端口</li>
</ul>
</li>
</ul>
<h2 id="配置开机自启动"><a href="#配置开机自启动" class="headerlink" title="配置开机自启动"></a>配置开机自启动</h2><h3 id="使用root用户复制粘贴全部下文：三个节点都做"><a href="#使用root用户复制粘贴全部下文：三个节点都做" class="headerlink" title="使用root用户复制粘贴全部下文：三个节点都做"></a>使用root用户复制粘贴全部下文：三个节点都做</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line">cat &gt; /lib/systemd/system/rc-local.service &lt;&lt;EOF</span><br><span class="line"></span><br><span class="line">[Unit]</span><br><span class="line">Description=/etc/rc.local Compatibility</span><br><span class="line">Documentation=man:systemd-rc-local-generator(8)</span><br><span class="line">ConditionFileIsExecutable=/etc/rc.local</span><br><span class="line">After=network.target</span><br><span class="line"></span><br><span class="line">[Service]</span><br><span class="line">Type=forking</span><br><span class="line">ExecStart=/etc/rc.local start</span><br><span class="line">TimeoutSec=0</span><br><span class="line">RemainAfterExit=yes</span><br><span class="line">GuessMainPID=no</span><br><span class="line"></span><br><span class="line">[Install]</span><br><span class="line">WantedBy=multi-user.target  </span><br><span class="line">Alias=rc-local.service</span><br><span class="line"></span><br><span class="line">EOF</span><br><span class="line"></span><br><span class="line">ln -s /lib/systemd/system/rc-local.service /etc/systemd/system/</span><br></pre></td></tr></table></figure>

<h3 id="1-1-1-2DB节点的-x2F-etc-x2F-rc-local-配置"><a href="#1-1-1-2DB节点的-x2F-etc-x2F-rc-local-配置" class="headerlink" title="1.1.1.2DB节点的 &#x2F;etc&#x2F;rc.local 配置"></a>1.1.1.2DB节点的 &#x2F;etc&#x2F;rc.local 配置</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">1.1.1.2主机</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">注意：eth网卡名称改成你自己的</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">注意：1.1.1.1ping网关改成你自己的</span></span><br><span class="line">cat &gt; /etc/rc.local &lt;&lt; EOF</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">!/bin/sh</span></span><br><span class="line"></span><br><span class="line">mkdir /tmp/WEICMLOG/</span><br><span class="line">chmod 777 /tmp/WEICMLOG</span><br><span class="line"></span><br><span class="line">cd /opt/gbase/sysInfo/WeiShell</span><br><span class="line">./WeiOsManager -i 1.1.1.6 -d ens33 -l 1.1.1.2 &gt; /tmp/WEICMLOG/WeiOsManager.log 2&gt;&amp;1 &amp; </span><br><span class="line"></span><br><span class="line"></span><br><span class="line">su - gbasedbt -c &quot;cd /home/gbase/sysInfo/WeiShell; ./WeiDbManager &gt; /tmp/WEICMLOG/WeiDbManager.log 2&gt;&amp;1 &amp; &quot;  </span><br><span class="line">su - gbasedbt -c &quot;cd /home/gbase/sysInfo/WeiShell; ./pingtest.sh  1.1.1.1 &gt; /tmp/WEICMLOG/pingtest.log 2&gt;&amp;1 &amp; &quot;</span><br><span class="line"></span><br><span class="line">EOF</span><br><span class="line">chmod 755  /etc/rc.local</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="1-1-1-3DB节点的-x2F-etc-x2F-rc-local-配置"><a href="#1-1-1-3DB节点的-x2F-etc-x2F-rc-local-配置" class="headerlink" title="1.1.1.3DB节点的 &#x2F;etc&#x2F;rc.local 配置"></a>1.1.1.3DB节点的 &#x2F;etc&#x2F;rc.local 配置</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">1.1.1.3主机，注意eth网卡名称改成你自己的</span></span><br><span class="line">cat &gt; /etc/rc.local &lt;&lt; EOF</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">!/bin/sh</span></span><br><span class="line"></span><br><span class="line">mkdir /tmp/WEICMLOG/</span><br><span class="line">chmod 777 /tmp/WEICMLOG</span><br><span class="line"></span><br><span class="line">cd /opt/gbase/sysInfo/WeiShell</span><br><span class="line">./WeiOsManager -i 1.1.1.6 -d ens33 -l 1.1.1.3 &gt; /tmp/WEICMLOG/WeiOsManager.log 2&gt;&amp;1 &amp; </span><br><span class="line"></span><br><span class="line"></span><br><span class="line">su - gbasedbt -c &quot;cd /home/gbase/sysInfo/WeiShell; ./WeiDbManager &gt; /tmp/WEICMLOG/WeiDbManager.log 2&gt;&amp;1 &amp; &quot;  </span><br><span class="line">su - gbasedbt -c &quot;cd /home/gbase/sysInfo/WeiShell; ./pingtest.sh  1.1.1.1 &gt; /tmp/WEICMLOG/pingtest.log 2&gt;&amp;1 &amp; &quot;</span><br><span class="line"></span><br><span class="line">EOF</span><br><span class="line">chmod 755  /etc/rc.local</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="1-1-1-1CM节点的-x2F-etc-x2F-rc-local-配置"><a href="#1-1-1-1CM节点的-x2F-etc-x2F-rc-local-配置" class="headerlink" title="1.1.1.1CM节点的 &#x2F;etc&#x2F;rc.local 配置"></a>1.1.1.1CM节点的 &#x2F;etc&#x2F;rc.local 配置</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">1.1.1.1主机</span></span><br><span class="line">cat &gt; /etc/rc.local &lt;&lt; EOF</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">!/bin/sh</span></span><br><span class="line"></span><br><span class="line">mkdir /tmp/WEICMLOG/</span><br><span class="line">chmod 777 /tmp/WEICMLOG</span><br><span class="line"></span><br><span class="line">cd /opt/gbase/sysInfo/CM/</span><br><span class="line">./runWeiCMAAABBBCCC.sh &gt; /tmp/WEICMLOG/runWeiCMAAABBBCCC.log 2&gt;&amp;1 &amp; </span><br><span class="line"></span><br><span class="line">EOF</span><br><span class="line">chmod 755  /etc/rc.local</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="设置网关IP"><a href="#设置网关IP" class="headerlink" title="设置网关IP"></a>设置网关IP</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sed -i &#x27;s/ipway=$1/ipway=1.1.1.1/&#x27; /home/gbase/sysInfo/WeiShell/GetNodeInfo.sh</span><br><span class="line"></span><br></pre></td></tr></table></figure>



<h2 id="重启所有节点操作系统"><a href="#重启所有节点操作系统" class="headerlink" title="重启所有节点操作系统"></a>重启所有节点操作系统</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">reboot</span><br><span class="line"></span><br></pre></td></tr></table></figure>



<h2 id="第一次启动1-1-1-2主DB节点服务"><a href="#第一次启动1-1-1-2主DB节点服务" class="headerlink" title="第一次启动1.1.1.2主DB节点服务"></a>第一次启动1.1.1.2主DB节点服务</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">ip addr add 1.1.1.6/24 dev ens33</span><br><span class="line">ip a |grep 1.1.1.6</span><br><span class="line">su - gbasedbt</span><br><span class="line">oninit -v</span><br><span class="line"></span><br></pre></td></tr></table></figure>



<h2 id="等待整个集群自动启动会恢复完成"><a href="#等待整个集群自动启动会恢复完成" class="headerlink" title="等待整个集群自动启动会恢复完成"></a>等待整个集群自动启动会恢复完成</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">cd /tmp/WEICMLOG/</span><br><span class="line">cat pingtest.log</span><br><span class="line">cat WeiDbManager.log</span><br><span class="line">cat WeiOsManager.log</span><br><span class="line">tail -f runWeiCMAAABBBCCC.log</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">cd /opt/gbase/sysInfo/CM/</span><br><span class="line">tail -f weicm.log</span><br><span class="line"></span><br></pre></td></tr></table></figure>



<h2 id="部署完成"><a href="#部署完成" class="headerlink" title="部署完成"></a>部署完成</h2><p>​		说明：至此整个集群部署完成，上面的“第一次启动1.1.1.2主节点服务”是应为所有节点数据库都关闭了，为了安全，程序不会做任何操作。如果集群里有只少一个节点活着，就不用手动做上述的这一步操作。</p>
<h2 id="交付应用"><a href="#交付应用" class="headerlink" title="交付应用"></a>交付应用</h2><p>业务连接数据库的服务名： gbase</p>
<p>业务连接数据库的IP为： 1.1.1.6</p>
<p>业务连接数据库的端口为： 9089</p>
<p>业务连接数据库的用户名密码： gbasedbt &#x2F; GBase123</p>
<h1 id="给WeiCM集群扩展备份恢复功能"><a href="#给WeiCM集群扩展备份恢复功能" class="headerlink" title="给WeiCM集群扩展备份恢复功能"></a>给WeiCM集群扩展备份恢复功能</h1><p>​		上述集群已经，基本上可以满足，故障点修复后集群的自动修复还原问题。考虑到集群有可能出现 “逻辑日志滚圈 和 备机重放日志冲突“ 的情况，这种情况下集群自动修复只有依赖备份恢复来完成。所有我对程序进行了进一步完善，给他添加了备机集群不能恢复时的，自动从主机拉取全量备份数据的功能。</p>
<blockquote>
<h3 id="扩展功能部署步骤"><a href="#扩展功能部署步骤" class="headerlink" title="扩展功能部署步骤"></a>扩展功能部署步骤</h3></blockquote>
<p>​			</p>
<h3 id="步骤01：WeiRssResort-部署"><a href="#步骤01：WeiRssResort-部署" class="headerlink" title="步骤01：WeiRssResort 部署"></a>步骤01：WeiRssResort 部署</h3><p>​		使用gbasedbt用户在两个DB节点上部署。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cp /opt/weicm/soft/newcm/WeiRssResort.sh /home/gbase/sysInfo/WeiShell</span><br><span class="line"></span><br></pre></td></tr></table></figure>



<h3 id="步骤02：配置开机启动"><a href="#步骤02：配置开机启动" class="headerlink" title="步骤02：配置开机启动"></a>步骤02：配置开机启动</h3><p>​		使用root用户在两个DB节点上部署。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">cat &gt;&gt; /etc/rc.local &lt;&lt; EOF</span><br><span class="line"></span><br><span class="line">su - gbasedbt -c &quot;cd /home/gbase/sysInfo/WeiShell; ./WeiRssResort.sh &gt; /tmp/WEICMLOG/WeiRssResort.log 2&gt;&amp;1 &amp; &quot;</span><br><span class="line"></span><br><span class="line">EOF</span><br><span class="line"></span><br></pre></td></tr></table></figure>



<h3 id="扩展备份恢复功能部署完成"><a href="#扩展备份恢复功能部署完成" class="headerlink" title="扩展备份恢复功能部署完成"></a>扩展备份恢复功能部署完成</h3><p>​		至此全部部署完成，WeiRssResort会检测所有RSS备机节点，是否日志落下一圈和异常，在RSS备节点无法同步集群日志时，对其做全量恢复并自动搭建集群。</p>
 
      <!-- reward -->
      
    </div>
    

    <!-- copyright -->
    
    <div class="declare">
      <ul class="post-copyright">
        <li>
          <i class="ri-copyright-line"></i>
          <strong>Copyright： </strong>
          
          Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
          
        </li>
      </ul>
    </div>
    
    <footer class="article-footer">
       
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=http://example.com/2023/05/10/GBase8s%E9%9B%86%E7%BE%A4%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8FWeiCM%E4%BB%8B%E7%BB%8D%E5%92%8C%E9%83%A8%E7%BD%B2%E6%AD%A5%E9%AA%A4/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>  
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%87%AA%E7%A0%94/" rel="tag">自研</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E9%9B%86%E7%BE%A4/" rel="tag">集群</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E9%AB%98%E5%8F%AF%E7%94%A8/" rel="tag">高可用</a></li></ul>

    </footer>
  </div>

   
  <nav class="article-nav">
    
      <a href="/2023/05/10/GBase8s%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E7%B1%BB%E5%9E%8B/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            GBase8s逻辑日志类型
          
        </div>
      </a>
    
    
      <a href="/2023/05/10/GBase8sMybatis%E6%B5%8B%E8%AF%95%E7%94%A8%E4%BE%8B/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">GBase8sMybatis测试用例</div>
      </a>
    
  </nav>

  
   
  
    
</article>

</section>
      <footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2023-2024
        <i class="ri-heart-fill heart_icon"></i> Wang Wei
      </li>
    </ul>
    <ul>
      <li>
        
      </li>
    </ul>
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>Visitors:<span id="busuanzi_value_site_uv"></span></span>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>Views:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
      </li>
    </ul>
  </div>
</footer>    
    </main>
    <div class="float_btns">
      <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

    </div>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ww.ico" alt="朝花夕拾"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/js/jquery-3.6.0.min.js"></script>
 
<script src="/js/lazyload.min.js"></script>

<!-- Tocbot -->
 
<script src="/js/tocbot.min.js"></script>

<script>
  tocbot.init({
    tocSelector: ".tocbot",
    contentSelector: ".article-entry",
    headingSelector: "h1, h2, h3, h4, h5, h6",
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: "main",
    positionFixedSelector: ".tocbot",
    positionFixedClass: "is-position-fixed",
    fixedSidebarOffset: "auto",
  });
</script>

<script src="https://cdn.staticfile.org/jquery-modal/0.9.2/jquery.modal.min.js"></script>
<link
  rel="stylesheet"
  href="https://cdn.staticfile.org/jquery-modal/0.9.2/jquery.modal.min.css"
/>
<script src="https://cdn.staticfile.org/justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js"></script>

<script src="/dist/main.js"></script>

<!-- ImageViewer -->

<!-- MathJax -->

<!-- Katex -->

<!-- busuanzi  -->
 
<script src="/js/busuanzi-2.3.pure.min.js"></script>
 
<!-- ClickLove -->

<!-- ClickBoom1 -->

<!-- ClickBoom2 -->

<!-- CodeCopy -->
 
<link rel="stylesheet" href="/css/clipboard.css">
 <script src="https://cdn.staticfile.org/clipboard.js/2.0.10/clipboard.min.js"></script>
<script>
  function wait(callback, seconds) {
    var timelag = null;
    timelag = window.setTimeout(callback, seconds);
  }
  !function (e, t, a) {
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '<i class="ri-file-copy-2-line"></i><span>COPY</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      $(".article pre code").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });
      clipboard.on('success', function(e) {
        let $btn = $(e.trigger);
        $btn.addClass('copied');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-checkbox-circle-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPIED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-checkbox-circle-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
      clipboard.on('error', function(e) {
        e.clearSelection();
        let $btn = $(e.trigger);
        $btn.addClass('copy-failed');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-time-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPY FAILED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-time-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
    }
    initCopyCode();
  }(window, document);
</script>
 
<!-- CanvasBackground -->

<script>
  if (window.mermaid) {
    mermaid.initialize({ theme: "forest" });
  }
</script>


    
    

  </div>
</body>

</html>